package com.agenda;

import com.agenda.R.id;

import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;

public class Cuenta extends Activity {
	
	private DBAdapter DB;
	private Cursor cursor;
	private String login, pass, valido, ua;
	private TextView l, p, u, fv;
	
	/** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ae_cuenta);
        
        //Quitamos barra de titulo de la aplicacion
        //this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        
        login = getIntent().getExtras().getString("usuario");
        //Toast.makeText(getApplicationContext(), login, Toast.LENGTH_SHORT).show();
        
        DB = new DBAdapter(this);
        DB.open(); 
        
        cursor = DB.fetchUsuario( login );
        
        /*login = cursor.getString( 1 );
		pass = cursor.getString( 2 );
		valido = cursor.getString( 3 );
		ua = cursor.getString( 4 );*/
        
        login = cursor.getString( 0 );
		pass = cursor.getString( 1 );
		valido = cursor.getString( 2 );
		ua = cursor.getString( 3 );
		
		l = (TextView)findViewById(R.id.textUser);
		p = (TextView)findViewById(R.id.textPass);
		u = (TextView)findViewById(R.id.textUAcc);
		fv = (TextView)findViewById(R.id.textFVenc);
		
		
		l.setText(login);
		p.setText(pass);
		u.setText(ua);
		fv.setText(valido);
		
		
      
    }
    
    public void regresar(View view) {
    	finish();
    }
    
    
    
    public void cambiarPass(View view) {
    	Intent i = new Intent(this, CambiarPass.class );
    	i.putExtra("usuario", login);
        startActivity(i);
    }
}
